{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 附录C 随书代码运行环境部署 \n",
    "\n",
    "____\n",
    "\n",
    "本书随书代码请查阅公众号：abu_quant获取。随书代码在ipython notebook中运行，运行本书所有示例代码分三步\n",
    "\n",
    "1. 部署好相关环境\n",
    "2. 下载随书代码\n",
    "3. 将终端cd切换到下载目录中，输入`jupyter notebook`\n",
    "\n",
    "caffe相关代码不在notebook中，见相关文件。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "下面说明运行环境。\n",
    "\n",
    "ipython作为python解释器的增强工具，以非常快捷的代码提示功能而受到广泛的喜好，ipython有多种环境，本书使用的是notebook环境，其它环境如shell和qt这里不做介绍。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### C.1 安装\n",
    "\n",
    "使用pip安装ipython和notebook（备注：早期的notebook后来改名jupyer）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "pip install ipython jupyter"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### C.2 启动\n",
    "\n",
    "启动notebook在shell中键入。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "jupyter notebook"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "默认配置下会启动电脑的默认浏览器打开http://localhost:8888/tree ，显示出当前工作目录下的所有文件信息。\n",
    "\n",
    "![](img/appendix/notebook.png)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### C.3 使用说明\n",
    "\n",
    "notebook中每一个可编辑项都是一个cell，cell有Markdown，code(python)等类型。\n",
    "\n",
    "Notebook支持Markdown让文档的编辑简单高效，即将代码的编写和文档的编写无缝的进行衔接，通过简单的Markdown编写文档方式，使开发者不必浪费过多的时间在文档格式，排版，布局等问题上（Markdown的详细使用请读者自行查阅相关资料）。如下图，新建一个ipynb文件。\n",
    "\n",
    "![](img/appendix/notebook2.png)\n",
    "\n",
    "notebook的最大的优点在于它的交互方式，可以执行python命令，也可以编辑markdown。初次接触notebook就被这种超强的交互方式所吸引，你可以将零散的思路一点一点变成代码，验证代码的有效性，以及更多的实验特性。\n",
    "\n",
    "![](img/appendix/notebook3.png)\n",
    "\n",
    "同时，notebook提供了一些特殊的功能，称之为魔法命令（magic）。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### C.4 Magic命令\n",
    "\n",
    "\n",
    "Magic命令有两种执行方式，以%开始的命令被称为行命令，它只对单行有效，以%%开头的为单元命令，它放在单元的第一行，对整个单元有效。\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 23.2 ms, sys: 7.14 ms, total: 30.3 ms\n",
      "Wall time: 26.6 ms\n"
     ]
    }
   ],
   "source": [
    "# 输出CPU的执行时间\n",
    "%time arry = [i for i in xrange(100000)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "100 loops, best of 3: 12.2 ms per loop\n"
     ]
    }
   ],
   "source": [
    "# 执行100次，输出最佳单次时间，用于分析性能十分有效\n",
    "%timeit arry = [i for i in xrange(100000)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1000 loops, best of 3: 12.2 ms per loop\n"
     ]
    }
   ],
   "source": [
    "# 执行100次，输出最佳单次时间\n",
    "%timeit -n 1000 arry = [i for i in xrange(100000)]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "* %%time：针对整个cell生效计算性能效率\n",
    "* %matplotlib inline：在notebook的cell中将可视化图像以网页内嵌的形式展示\n",
    "\n",
    "使用示例如下："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAhAAAAFkCAYAAABxWwLDAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAAPYQAAD2EBqD+naQAAIABJREFUeJzt3XmczWX/x/HXx1CWypKiTdEid1FR0a5dKSItExGREFJK\n2qMF2bdUSIUpdyoiudPy04K6aY+4lbjLUirZxjbX749r3DEZM2dmzrnO8n4+HudRjnNm3o7lvM/1\nvRZzziEiIiISiWKhA4iIiEjiUYEQERGRiKlAiIiISMRUIERERCRiKhAiIiISMRUIERERiZgKhIiI\niERMBUJEREQipgIhIiIiEVOBEBERkYhFtUCY2TlmNtXMfjKzLDNrlI/n1Dez+WaWaWaLzaxVNDOK\niIhI5KI9AlEG+BzoCOR56IaZHQVMA94BTgKGAKPN7OLoRRQREZFIWawO0zKzLOAq59zUvTymL3CZ\nc67WLvdlAGWdc5fHIKaIiIjkQ7zNgagHzMpx30zgjABZREREJBfFQwfIoTKwOsd9q4EDzGxf59yW\nnE8wswOBS4FlQGbUE4qIiCSPksBRwEzn3NpInhhvBaIgLgUmhA4hIiKSwJoDEyN5QrwViFVApRz3\nVQL+3NPoQ7ZlAOPHj6dGjRpRjJYYunXrxqBBg6L+fVatghkz4O234bvv/H1HHQX/+AccfTQceigc\ndBCUKQP77APbt8PmzfD77/Dzz/Djj7BwoX/u1q3+seefD5dfDieeCGaFyxer1yER6LXw9Dp4eh3+\notcCFi5cSIsWLSD7vTQS8VYg5gCX5bjvkuz7c5MJUKNGDWrXrh2tXAmjbNmyUXsdnINZs2DgQJg5\nE0qWhEaN4IEH4JJLfAmIVGYmfPABvPkmTJrkbzVqQNeucOONULp0wbJG83VINHotPL0Onl6Hv+i1\n2E3EUwCivQ9EGTM7ycxOzr6rWva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kJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x10451dad0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 237 ms, sys: 8.75 ms, total: 245 ms\n",
      "Wall time: 245 ms\n"
     ]
    }
   ],
   "source": [
    "%%time\n",
    "%matplotlib inline # 让matplotlib 绘图嵌入到notebook中\n",
    "import matplotlib.pyplot as plt\n",
    "import math\n",
    "\n",
    "a = range(0, 360+1) #度数\n",
    "x = map(lambda x:math.pi*x/180.0, a)# 弧度\n",
    "plt.plot(x,map(lambda x:math.sin(x), x))\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "还支持一些简单的shell命令，如"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The file /Users/baidu/maxmon/ml_book/notebook/non-exist.txt does not exist.\r\n"
     ]
    }
   ],
   "source": [
    "!open non-exist.txt"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "以上简单介绍了魔法命令的用法，更多高级玩法读者可自行查阅资料。"
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
